<?php
namespace app\admin\validate;

use think\Validate;

/**
 * @author : SN
 * @time   : 2020/3/30 16:58
 * @des    : 校验Account
 */
class Account extends BaseValidate
{
    //校验规则
    protected $rule = [
        'username' => 'require|regex:^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,12}$',
        'password' => 'require|length:6,16',
        'mobile' => 'require|mobile',
    ];

    //错误信息提示
    protected $message = [
        'username.require' => '用户名不能为空',
        'username.regex' => '用户名必须是6到12位的字母和数字的组合',
        'password.require' => '密码不能为空',
        'password.length' => '密码长度必须是6到16位',
        'mobile.require' => '手机号不能为空',
        'mobile.mobile' => '请输入正确的手机号',
    ];

}